﻿
@{
    Layout = null;
}




<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layuiAdmin 网站用户 iframe 框</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    @*<link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">*@
    <link href="https://cdn.staticfile.org/layui/2.7.6/css/layui.css" rel="stylesheet">
    <link rel="stylesheet" href="~/Content/layuiadmin/style/admin.css" media="all">
</head>
<body>

    <div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin" style="padding: 20px 0 0 0;">
        <form class="layui-form" lay-filter="form" onsubmit="return false">
            <div class="layui-form-item">
                <label class="layui-form-label">用户名</label>
                <div class="layui-input-inline">
                    <input type="text" name="username" id="UserName" lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">密码</label>
                <div class="layui-input-inline">
                    <input type="text" name="PassWord" id="PassWord" lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">确认密码</label>
                <div class="layui-input-inline">
                    <input type="text" name="RePassWord" id="RePassWord" lay-verify="required" placeholder="请确认密码" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item layui-hide">
                <input type="button" lay-submit lay-filter="LAY-user-front-submit" id="LAY-user-front-submit" value="确认" onclick="add()">
            </div>
        </form>
    </div>
    <script src="~/Scripts/tools.js"></script>
    <script src="~/Scripts/jquery-3.3.1.min.js"></script>
    <script src="https://cdn.staticfile.org/layui/2.7.6/layui.js"></script>
    <script>
        layui.config({
            base: '/Content/layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'form', 'upload'], function () {
            var $ = layui.$
                , form = layui.form
                , upload = layui.upload;

            upload.render({
                elem: '#layuiadmin-upload-useradmin'
                , url: layui.setter.base + 'json/upload/demo.js'
                , accept: 'images'
                , method: 'get'
                , acceptMime: 'image/*'
                , done: function (res) {
                    $(this.item).prev("div").children("input").val(res.data.src)
                }
            });

        })

        function add() {
            var data = {};
            data.UserName = $("#UserName").val();
            data.PassWord = $("#PassWord").val();
            data.RePassWord = $("#RePassWord").val();
            if (data.PassWord != data.RePassWord) {
                layer.msg("两次密码不一致", { icon: 5, anim: 6 });
                return;
            }
            $.post(apiurl + "api/User/Add", data, function (res) {
                
                if (res.Code == 200) {
                    layer.msg("添加成功");
                }
                else {
                    layer.msg("添加失败");
                }
            })
        }

    </script>
</body>
</html>